package com.ofr.controller.common;

import com.ofr.ejb.dao.UserDao;
import com.ofr.ejb.entities.User;
import com.ofr.ejb.service.UserService;
import com.ofr.util.Constants;

import javax.annotation.PostConstruct;
import javax.ejb.EJB;
import javax.enterprise.context.RequestScoped;
import javax.inject.Named;

/**
 * Created with IntelliJ IDEA.
 * User: imon
 * Date: 3/29/13
 * Time: 10:52 PM
 * To change this template use File | Settings | File Templates.
 */
@Named
@RequestScoped
public class SignUpController implements Constants{
    private User user;

    @EJB
    private UserService userService;

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    @PostConstruct
    public void init() {
        user = new User();
    }

    public String signUp() {
        System.out.println("save user: start");
        userService.signUpService(user);

        System.out.println("save user: end");
        return SIGN_UP_SUCCESSFUL;
    }
}
